/**
 * 
 */
package co.fitstart.mobile.security;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import co.fitstart.entity.user.User;
import co.fitstart.mobile.service.UserService;

/**
 * @author lute
 *
 */
@Component("authenticationProvider")
public class AuthenticationProvider {

    private static final Logger logger = LoggerFactory.getLogger(AuthenticationProvider.class);
    
    @Autowired
    private UserService userService;
    
    /**
     * Load user by mobile
     * 
     * @param mobile
     * @return
     */
    public User loadUser(String mobile) {
        
        logger.trace("AuthenticationProvider#loadUser() - Going to load user by mobile [{}].", mobile);
        
        return userService.getUser(mobile);
    }

}
